import request from '../utils/request.js'

// 封装方法获取用户资料
const getUserInfoAPI = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user'
  })
}

// 封装方法获取用户个人资料
const getUserProfileAPI = () => {
  return request({
    url: '/v1_0/user/profile',
    method: 'GET'
  })
}

// 封装方法更新用户头像
const updateUserPhotoAPI = ({ form }) => {
  return request({
    method: 'PATCH',
    url: '/v1_0/user/photo',
    data: form
  })
}

// 封装方法更新用户名
const updateusernameAPI = ({ name, birthday }) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data: {
      name,
      birthday
    }
  })
}

// 更新token
const updatetokenAPI = () => {
  return request({
    url: '/v1_0/authorizations',
    method: 'PUT'

  })
}
// 导出
export {
  getUserInfoAPI,
  getUserProfileAPI,
  updateUserPhotoAPI,
  updateusernameAPI,
  updatetokenAPI
}
